package com.service;

import com.mapper.InternalMessageMapper;
import com.service.impl.InternalMessageServiceImpl;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.when;

/**
 * <p>
 * 站内信与邮件通知 Service 测试类
 * </p>
 * @author 34448
 */
public class InternalMessageServiceTest {

    @Mock
    private InternalMessageMapper internalMessageMapper;

    @InjectMocks
    private InternalMessageServiceImpl internalMessageService;

    @BeforeEach
    public void setUp() {
        MockitoAnnotations.openMocks(this);
    }

    @Test
    public void testCountUnreadInternalMessages() {
        Integer expected = 5;

        when(internalMessageMapper.countUnreadInternalMessages()).thenReturn(expected);

        Integer result = internalMessageService.countUnreadInternalMessages();
        assertEquals(expected, result);
    }
}